do_privcmd() was only ever used by do_xen_hypercall() so remove it.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
return close(fd);
}
+static int linux_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall)
+{
+ int fd = (int)h;
+ return ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
+}
+
static int xc_map_foreign_batch_single(xc_interface *xch, uint32_t dom,
xen_pfn_t *mfn, unsigned long addr)
{
return ret;
}
-static int do_privcmd(xc_interface *xch, int cmd, unsigned long data)
-{
- return ioctl(xch->fd, cmd, data);
-}
-
-int do_xen_hypercall(xc_interface *xch, privcmd_hypercall_t *hypercall)
-{
- return do_privcmd(xch, IOCTL_PRIVCMD_HYPERCALL,
- (unsigned long)hypercall);
-}
-
static struct xc_osdep_ops linux_privcmd_ops = {
.open = &linux_privcmd_open,
.close = &linux_privcmd_close,
+
+ .u.privcmd = {
+ .hypercall = &linux_privcmd_hypercall,
+ },
};
#define DEVXEN "/dev/xen/"
files[fd].type = FTYPE_NONE;
}
+static int minios_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall)
+{
+ multicall_entry_t call;
+ int i, ret;
+
+ call.op = hypercall->op;
+ for (i = 0; i < sizeof(hypercall->arg) / sizeof(*hypercall->arg); i++)
+ call.args[i] = hypercall->arg[i];
+
+ ret = HYPERVISOR_multicall(&call, 1);
+
+ if (ret < 0) {
+ errno = -ret;
+ return -1;
+ }
+ if ((long) call.result < 0) {
+ errno = - (long) call.result;
+ return -1;
+ }
+ return call.result;
+}
+
void *xc_map_foreign_bulk(xc_interface *xch, uint32_t dom, int prot,
const xen_pfn_t *arr, int *err, unsigned int num)
{
}
-int do_xen_hypercall(xc_interface *xch, privcmd_hypercall_t *hypercall)
-{
- multicall_entry_t call;
- int i, ret;
-
- call.op = hypercall->op;
- for (i = 0; i < sizeof(hypercall->arg) / sizeof(*hypercall->arg); i++)
- call.args[i] = hypercall->arg[i];
-
- ret = HYPERVISOR_multicall(&call, 1);
-
- if (ret < 0) {
- errno = -ret;
- return -1;
- }
- if ((long) call.result < 0) {
- errno = - (long) call.result;
- return -1;
- }
- return call.result;
-}
-
static struct xc_osdep_ops minios_privcmd_ops = {
.open = &minios_privcmd_open,
.close = &minios_privcmd_close,
+
+ .u.privcmd = {
+ .hypercall = &minios_privcmd_hypercall,
+ },
};
static xc_osdep_handle minios_evtchn_open(xc_evtchn *xce)
return close(fd);
}
+static int netbsd_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall)
+{
+ int fd = (int)h;
+ int error = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
+
+ if (error < 0)
+ return -errno;
+ else
+ return hypercall->retval;
+}
+
void *xc_map_foreign_batch(xc_interface *xch, uint32_t dom, int prot,
xen_pfn_t *arr, int num)
{
return NULL;
}
-
-static int do_privcmd(xc_interface *xch, unsigned int cmd, unsigned long data)
-{
- int err = ioctl(xch->fd, cmd, data);
- if (err == 0)
- return 0;
- else
- return -errno;
-}
-
-int do_xen_hypercall(xc_interface *xch, privcmd_hypercall_t *hypercall)
-{
- int error = do_privcmd(xch,
- IOCTL_PRIVCMD_HYPERCALL,
- (unsigned long)hypercall);
- if (error)
- return error;
- else
- return (hypercall->retval);
-}
-
static struct xc_osdep_ops netbsd_privcmd_ops = {
.open = &netbsd_privcmd_open,
.close = &netbsd_privcmd_close,
+
+ .u.privcmd = {
+ .hypercall = &netbsd_privcmd_hypercall;
+ },
};
#define EVTCHN_DEV_NAME "/dev/xenevt"
return xc_interface_close_common(xch);
}
+
+int do_xen_hypercall(xc_interface *xch, privcmd_hypercall_t *hypercall)
+{
+ return xch->ops->u.privcmd.hypercall(xch, xch->ops_handle, hypercall);
+}
+
xc_evtchn *xc_evtchn_open(xentoollog_logger *logger,
unsigned open_flags)
{
return close(fd);
}
+static int solaris_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall)
+{
+ int fd = (int)h;
+ return ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
+}
+
void *xc_map_foreign_batch(xc_interface *xch, uint32_t dom, int prot,
xen_pfn_t *arr, int num)
{
return NULL;
}
-static int do_privcmd(xc_interface *xch, unsigned int cmd, unsigned long data)
-{
- return ioctl(xch->fd, cmd, data);
-}
-
-int do_xen_hypercall(xc_interface *xch, privcmd_hypercall_t *hypercall)
-{
- return do_privcmd(xch,
- IOCTL_PRIVCMD_HYPERCALL,
- (unsigned long)hypercall);
-}
-
static struct xc_osdep_ops solaris_privcmd_ops = {
.open = &solaris_privcmd_open,
.close = &solaris_privcmd_close,
+
+ .u.privcmd = {
+ .hypercall = &solaris_privcmd_hypercall;
+ },
};
static xc_osdep_handle solaris_evtchn_open(xc_evtchn *xce)
xc_osdep_handle (*open)(xc_interface *xch);
int (*close)(xc_interface *xch, xc_osdep_handle h);
+
+ union {
+ struct {
+ int (*hypercall)(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall);
+ } privcmd;
+ } u;
};
typedef struct xc_osdep_ops xc_osdep_ops;